package com.hsmpay.mobile.service.account;

import com.hsmpay.common.pojo.qian4.Qian4SendLog;
import com.hsmpay.common.service.BaseService;
import com.hsmpay.mobile.action.account.scanCodePay.ScanCodePayParam;
import com.hsmpay.mobile.pojo.terminal.Tchannel;
import com.hsmpay.mobile.pojo.trans.TransOrder;
import com.hsmpay.mobile.pojo.trans.TransPriorSettle;
import com.hsmpay.qian4.pojo.PurchaseResult;

import java.io.Serializable;
import java.util.Map;

/**
 * 账务管理  服务接口 accountManageQ4Service
 * 对应dao 相关dao  对应多个dao
 *
 * @param <Entity>
 * @param <Query>
 * @author 颜铃璋
 *         创建时间：2013-1-24
 */
public interface AccountManageQ4Service<Entity extends Serializable, Query extends Object> extends BaseService<Entity, Query> {
    /**
     * 提前下单  并保存数据
     *
     * @param transOrder       订单信息
     * @param send             日志信息
     * @param collectionTypeId 通道ID
     * @return
     * @throws Exception
     */
    public TransPriorSettle advanceOrder(TransOrder transOrder, Qian4SendLog send, Integer collectionTypeId) throws Exception;

    /**
     * 解析收款结果
     *
     * @param pr
     * @param tc
     * @param orgId
     * @return
     * @throws Exception
     */
    public TransPriorSettle purchaseResolveResult(TransPriorSettle transPs, Qian4SendLog send, PurchaseResult pr, Tchannel tc, Long orgId) throws Exception;

    /**
     * 我要收款 失败
     *
     * @param transPs
     * @param resCode
     * @param resMsg
     * @return
     * @throws Exception
     */
    public int receivablesError(TransPriorSettle transPs, String resCode, String resMsg) throws Exception;

    /**
     * 撤销订单
     *
     * @param send
     * @return
     * @throws Exception
     */
    public Map<String, Object> revocationOrder(Qian4SendLog send) throws Exception;

    /**
     * 用于中亿在服务器端撤销订单
     *
     * @param send
     * @return
     * @throws Exception
     */
    public Map<String, Object> revocationOrderForZY(Qian4SendLog send) throws Exception;

    /**
     * 判断是否 可以撤销
     * status 1 成功  0 失败  2 无法撤销
     *
     * @param send
     * @return
     * @throws Exception
     */
    public Map<String, Object> isCanRevocationOrder(Qian4SendLog send) throws Exception;

    /**
     * 添加用户明细信息
     * 修改虚拟货币
     *
     * @param transOrder 订单对象
     * @param incExp     1收入 0为支出（对于虚拟货币）
     * @param money      收入 支出的钱
     * @return
     * @throws Exception
     */
    public int updateUserMoney(TransOrder transOrder, int incExp, double money) throws Exception;

    /**
     * 扫码支付撤销订单
     *
     * @param send
     * @return
     * @throws Exception
     */
    public Map<String, Object> scanRevocationOrder(Qian4SendLog send, ScanCodePayParam scanCodePayParam) throws Exception;

}
